export function getLocation() {
  return new Promise((resolve, reject) => {
    // #ifdef MP-WEIXIN
    wx.getLocation({
      type: 'wgs84',
      success(res) {
        resolve({
          latitude: res.latitude,
          longitude: res.longitude
        });
      },
      fail(err) {
        reject(err);
      }
    });
    // #endif

    // #ifdef APP-PLUS
    plus.geolocation.getCurrentPosition(
      (position) => {
        resolve({
          latitude: position.coords.latitude,
          longitude: position.coords.longitude
        });
      },
      (error) => {
        reject(error);
      }
    );
    // #endif
  });
} 